package com.junction.thread;

import com.junction.pojo.TaskPojo;
import com.junction.util.KeyHook;
import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.FFmpegFrameRecorder;
import org.bytedeco.javacv.Frame;

import java.io.File;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import static org.bytedeco.ffmpeg.global.avcodec.AV_CODEC_ID_H264;

public class KeyboardListenerThread {
    public static class MyRunnable implements Runnable {
        // 创建线程池
        public static ExecutorService es = Executors.newCachedThreadPool();
        private Thread nowThread;


        public MyRunnable() {

        }

        // 中断线程
        public void setInterrupted() {
            nowThread.interrupt();
        }

        @Override
        public void run() {
            try {

                KeyHook.win32KeyHook();

            } catch (Exception e) {
                System.err.println(
                        "当前线程：" + Thread.currentThread().getName() + " 当前任务：KeyHook 停止...");
                e.printStackTrace();
            }
        }
    }
}
